<?php


function add_gc_filters_price_filter_pane(&$gcFilterParameters = null) {
  //$max_price = $gcFilterParameters->maxPrice(); // przechowuje maksymalną cenę dla produktów z przedziału
  //$min_price = $gcFilterParameters->minPrice(); // przechowuje minimalną cenę dla produktów z przedziału  

  $default = 0;
  if(isset($_GET['gcfPriceMin'])) {
    $defaultMin = ($_GET['gcfPriceMin']);
  }
  if(isset($_GET['gcfPriceMax'])) {
    $defaultMax = ($_GET['gcfPriceMax']);
  }
 /* $options = array();
  $ranges = $gcFilterParameters->priceRanges();
  $options[0] = t('none selected');
  for($i=1; $i<=count($ranges)-1; $i++) {
    $options[$i] = round($ranges[$i]['min']).' to '.round($ranges[$i]['max']);
  }*/
  $form = array();
  $form = array(
    '#type' => 'fieldset',
    '#title' => t('choose price range'),
    '#weight' => 5,
    '#collapsible' => FALSE,
    '#collapsed' => FALSE,
  );
  $form['min'] = array(
    '#title' => t('from'),
    '#type' => 'textfield',
    '#size' => 6,
    '#maxlength' => 5,
    '#default_value' => $defaultMin 
  );
  $form['max'] = array(
    '#title' => t('to'),
    '#type' => 'textfield',
    '#size' => 6,
    '#maxlength' => 5,
    '#default_value' => $defaultMax
  );  
  return $form;
  
}

function add_gc_filters_price_sorting_filter_pane(&$gcFilterParameters = null) {
  $default = 0;
  if(isset($_GET['gcfPriceSort'])) {
    $default = ($_GET['gcfPriceSort']);
  }
  $form = array(
    '#type' => 'select',
    '#title' => t('select price sorting method'),
    '#options' => array(
        0 => t('none selected'),
        'asc' => t('ascending'),
        'desc' => t('descending'),
    ),
    '#default_value' => $default 
  );
  return $form;  
}





